// ex9_3.cpp
#include <iostream>
#include <cstring>
const int BUF = 20;
struct chaff
{
	char dross[20];
	int slag;
};

int main(void)
{
	using namespace std;
	chaff *ptr = new chaff[2];
	char drossname[BUF];	
	int count = 0;
	
	while (count < 2)
	{
		cout << "Enter dross: ";
		cin.getline(drossname, BUF);
		if (strlen(drossname) != 0)
			strncpy(ptr[count].dross, drossname, strlen(drossname));
		else
			break;
		cout << "Enter slag: ";
		cin >> ptr[count].slag;
		++count;
		cin.get();
	}
	cout << "\n"<< ptr[0].dross << " " << ptr[0].slag << "\n"; 

	cout << ptr[1].dross << " "
		 << ptr[1].slag << "\n"; 
	delete ptr;
	cout << "Bye!\n" << endl;
	return 0;
}
